import { legacy_createStore as createStore } from 'redux';

const initState = { count: 100, msg: 'hello React' };

function countReducer(state = initState, action) {
  switch (action.type) {
    case 'add':
      return { ...state, count: state.count + action.payload };
    case 'des':
      return { ...state, count: state.count - action.payload };

    default:
      return state;
  }
}

const store = createStore(countReducer);

export default store;
